<script language="javascript" src="<?php echo JQUERYUI ?>jquery.ui.mouse.min.js"></script>
<script language="javascript" src="<?php echo JQUERYUI ?>jquery.ui.draggable.min.js"></script>
<script language="javascript" src="<?php echo JQUERYUI ?>jquery.ui.position.min.js"></script>
<script language="javascript" src="<?php echo JQUERYUI ?>jquery.ui.resizable.min.js"></script>
<script language="javascript" src="<?php echo JQUERYUI ?>jquery.ui.dialog.min.js"></script>
<script>
    $(document).ready(function() {
		$( ".date" ).datepicker();
		$( ".date" ).datepicker( "option", "dateFormat", "dd-mm-yy");
		
		$( '#jenis_bbm' ).change(function(){
			pilihan=$( '#jenis_bbm' ).val();
			if(pilihan=='cash'){
				$( '.cash' ).show();
				$( '.voucher' ).hide();
			}else{
				$( '.cash' ).hide();
				$( '.voucher' ).show();
			}
		});
                // biaya
		$("#perpal").change(function(){
			$("#total_biaya_langsung")
			.attr("value",(
				parseInt($("#perpal").val())+parseInt($("#bbm_cash").val())+parseInt($("#parkirtol").val())+parseInt($("#ferry_penyebrangan").val())+
				parseInt($("#makan_penumpang").val())+
				parseInt($("#snack_penumpang").val())+parseInt($("#koordinasi_lapangan").val())));
		});
		$("#bbm_cash").change(function(){
			$("#total_biaya_langsung")
			.attr("value",(
				parseInt($("#perpal").val())+parseInt($("#bbm_cash").val())+parseInt($("#parkirtol").val())+parseInt($("#ferry_penyebrangan").val())+
				parseInt($("#makan_penumpang").val())+
				parseInt($("#snack_penumpang").val())+parseInt($("#koordinasi_lapangan").val())));
		});
		$("#parkirtol").change(function(){
			$("#total_biaya_langsung")
			.attr("value",(
				parseInt($("#perpal").val())+parseInt($("#bbm_cash").val())+parseInt($("#parkirtol").val())+parseInt($("#ferry_penyebrangan").val())+
				parseInt($("#makan_penumpang").val())+
				parseInt($("#snack_penumpang").val())+parseInt($("#koordinasi_lapangan").val())));
		});
		$("#ferry_penyebrangan").change(function(){
			$("#total_biaya_langsung")
			.attr("value",(
				parseInt($("#perpal").val())+parseInt($("#bbm_cash").val())+parseInt($("#parkirtol").val())+parseInt($("#ferry_penyebrangan").val())+
				parseInt($("#makan_penumpang").val())+
				parseInt($("#snack_penumpang").val())+parseInt($("#koordinasi_lapangan").val())));
		});
		$("#makan_penumpang").change(function(){
			$("#total_biaya_langsung")
			.attr("value",(
				parseInt($("#perpal").val())+parseInt($("#bbm_cash").val())+parseInt($("#parkirtol").val())+parseInt($("#ferry_penyebrangan").val())+
				parseInt($("#makan_penumpang").val())+
				parseInt($("#snack_penumpang").val())+parseInt($("#koordinasi_lapangan").val())));
		});
		$("#snack_penumpang").change(function(){
			$("#total_biaya_langsung")
			.attr("value",(
				parseInt($("#perpal").val())+parseInt($("#bbm_cash").val())+parseInt($("#parkirtol").val())+parseInt($("#ferry_penyebrangan").val())+
				parseInt($("#makan_penumpang").val())+
				parseInt($("#snack_penumpang").val())+parseInt($("#koordinasi_lapangan").val())));
		});
		$("#koordinasi_lapangan").change(function(){
			$("#total_biaya_langsung")
			.attr("value",(
				parseInt($("#perpal").val())+parseInt($("#bbm_cash").val())+parseInt($("#parkirtol").val())+parseInt($("#ferry_penyebrangan").val())+
				parseInt($("#makan_penumpang").val())+
				parseInt($("#snack_penumpang").val())+parseInt($("#koordinasi_lapangan").val())));
		});
                } );
</script>
<form method="post" action="<?php echo RESER ?>process_setoran_awal">
	<table align="center" width="700">
		<tr>
			<td width="230">
				Nomor SPJ :
			</td>
			<td>
				<input type="text" name="NoSPJ" value="<?php echo $reservasi['NoSPJ'] ?>" readonly size="30"/>
			</td>
		</tr>
		<tr>
			<td>
				NOPOL :
			</td>
			<td>
				<input type="text" name="NoPol" readonly value="<?php echo $reservasi['NoPol'] ?>"/>
			</td>
		</tr>
                <tr>
			<td>
				Nama Kasir :
			</td>
			<td>
				<input type="text" name="nama_kasir" readonly value="<?php echo $this->session->userdata('nama') ?>"/>
                                <input type="hidden" name="cabang_keberangkatan" readonly value="<?php echo $reservasi['KodeCabang'] ?>"/>
			</td>
		</tr>
        <tr>
			<td>
				Nama Driver :
			</td>
			<td>
				<input type="text" name="driver" readonly value="<?php echo $reservasi['Driver'] ?>"/>
			</td>
		</tr>
        <tr>
			<td>
				Rute :
			</td>
			<td>
				<input type="text" name="asal" readonly value="<?php echo $reservasi['Asal'] ?>"/> - 
				<input type="text" name="tujuan" readonly value="<?php echo $reservasi['Tujuan'] ?>"/>
			</td>
		</tr>
        <tr>
			<td>
				Tanggal Pembayaran :
			</td>
			<td>
				<input class="date" type="text" name="tanggal" value="<?php echo date("m/d/Y"); //$this->date_func->change_format_date(date(), 'M d Y g:iA', 'm/d/Y')  ?>"/>
			</td>
		</tr>
        <tr>
			<td>
				Jumlah Seat :
			</td>
			<td>
				<input type="text" name="total_kapasitas" readonly value="<?php echo $jumlah_seat['JumlahKursi'] ?>"/>
			</td>
		</tr>
        <tr>
			<td>
				Jumlah Penumpang :
			</td>
			<td>
				<input type="text" name="total_penumpang" readonly value="<?php echo $jumlah_penumpang['PesanKursi'] ?>"/>
			</td>
		</tr>
        <tr>
            <td colspan="2">
				PENJUALAN
			</td>
		</tr>
        <tr>
			<td>
				Penjualan Kotor :
			</td>
			<td>
                            <input type="text" id="penjualan_kotor" readonly name="penjualan_kotor" value="<?php echo $subtotal['SubTotal'] ?>"/>
			</td>
		</tr>
        <tr>
            <td colspan="2">
				BIAYA AWAL
			</td>
		</tr>
        <tr>
			<td>
				Fee Driver :
			</td>
			<td>
                            <input type="text" id="fee_driver" readonly name="fee_driver" value="<?php echo (($fee_driver*$jumlah_penumpang['PesanKursi']) + (($chargeA['ChargeA'] + $chargeB['ChargeB']) * $charge_supir/100)) ?>"/>
                                
			</td>
		</tr>
        <tr>
			<td>
				PERPAL :
			</td>
			<td>
				<input type="text" id="perpal" name="perpal" value="0"/>
			</td>
		</tr>
		<tr>
			<td>
				Pilihan BBM :
			</td>
			<td>
				<select id="jenis_bbm" name="jenis_bbm"">
						<option>cash</option>
					<option>voucher</option>
				</select>
			</td>
		</tr>
		<tr class="cash">
			<td>
				Jumlah :
			</td>
			<td>
				<input type="text" id="bbm_cash" name="bbm_cash" value=""/>
			</td>
		</tr>
		<tr class="voucher" style="display:none">
			<td>
				SPBU
			</td>
			<td>
				<?php
				for ($i = 0; $i < count($spbu); $i++) {
					$opt[$spbu[$i]['id']] = $spbu[$i]['nama'];
				}
				echo form_dropdown('idspbu', $opt);
				?>
			</td>
		</tr>
		<tr class="voucher" style="display:none">
			<td>
				Kode Voucher :
			</td>
			<td>
				<?php
				echo '<input type="text" name="kode_voucher"/>';
				?>
			</td>
		</tr>
		<tr class="voucher" style="display:none">
			<td>
				Jenis BBM :
			</td>
			<td>
				<select name="tipe_bbm">
					<option>solar</option>
					<option>premium</option>
				</select>
			</td>
		</tr>
		<tr class="voucher" style="display:none">
			<td>
				Jumlah Liter:
			</td>
			<td>
				<input type="text" name="jumlah_liter"/>
			</td>
		</tr>
		<tr class="voucher" style="display:none">
			<td>
				Jumlah Biaya :
			</td>
			<td>
				<input type="text" name="jumlah_uang"/>
			</td>
		</tr>
        <tr>
			<td>
				Parkir & Tol :
			</td>
			<td>
				<input type="text" id="parkirtol" name="parkirtol" value="0"/>
			</td>
		</tr>
        <tr>
			<td>
				Ferry Penyebrangan :
			</td>
			<td>
				<input type="text" id="ferry_penyebrangan" name="ferry_penyebrangan" value="0"/>
			</td>
		</tr>
        <tr>
			<td>
				Makan Penumpang :
			</td>
			<td>
				<input type="text" id="makan_penumpang" name="makan_penumpang" value="0"/>
			</td>
		</tr>
        <tr>
			<td>
				Snack Penumpang :
			</td>
			<td>
				<input type="text" id="snack_penumpang" name="snack_penumpang" value="0"/>
			</td>
		</tr>
        <tr>
			<td>
				Koordinasi Lapangan :
			</td>
			<td>
				<input type="text" id="koordinasi_lapangan" name="koordinasi_lapangan" value="0"/>
			</td>
		</tr>
		<tr>
			<td>
				TOTAL BIAYA :
			</td>
			<td>
				<input type="text" readonly id="total_biaya_langsung" name="total_biaya_langsung" value="0"/>
			</td>
		</tr>
		<tr>
			<td colspan="2" align="center">
				<input type="submit" value="Buat"/>
			</td>
		</tr>
	</table>
</form>